// 引入axios
import Vue from 'vue'
import promise from 'es6-promise'
import axios from 'axios'
promise.polyfill()

let baseUrl = 'http://172.16.4.129:9999';
if(process.env.NODE_ENV == 'development'){
  baseUrl = 'http://172.16.4.129:9999';//开发环境baseurl
}else if(process.env.NODE_ENV == 'debug'){
  baseUrl = 'http://172.16.4.129:9999';//测试环境baseurl
}

export const baseURL = baseUrl
export const uploadURL = baseUrl

const service = axios.create({
  baseURL: baseUrl,
  headers: {
    'X-Requested-With': 'XMLHttpRequest',
    'Content-Type' : 'application/x-www-form-urlencoded',
    'Access-Control-Allow-Origin': '*'
  },
  withCredentials: true,
  timeout: 20000 // 请求超时 20s
})



export default service
